package keter.service;

import java.util.Iterator;
import java.util.List;
import java.util.Map;

import keter.dao.CodeListDao;
import keter.domain.CodeList;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.google.common.collect.Maps;

@Service
@Transactional
public class CodeListService {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = LoggerFactory.getLogger(CodeListService.class);
	
	@Autowired
	private CodeListDao dao;
	
	/**
	 * <p>Method ：findDepartment
	 * <p>Description : 查找下级单元
	 *
	 * @param collegeId
	 * @return 
	 * @author  顾力行-gulixing@msn.com
	 */
	public Map<String, String> findByCodeKind(String codekind){
        List<CodeList> list = dao.findByCodeKind(codekind);
        Map<String, String> map = Maps.newLinkedHashMap();
        for (Iterator<CodeList> iterator = list.iterator(); iterator.hasNext();) {
            CodeList c = (CodeList) iterator.next();
            map.put(c.getCodeValue(), c.getCodeName());
        }
        return map;
	}

}
